package a.a010;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class Test0 {

	
	public static void main(String[] args) throws Exception {
		
		File file = new File("src/main/java/a/a010/test0.xlsx");
		System.out.println(file.getAbsolutePath());
		
		
		FileInputStream fis = new FileInputStream(file);
		XSSFWorkbook xwb = new XSSFWorkbook(fis);
		
		
		XSSFRow row0 = xwb.getSheet("MY_STYLE").getRow(0);
		XSSFRow row1 = xwb.getSheet("Sheet1").getRow(0);
		
		/** ===================================================== */
		
		XSSFCellStyle cellStyle0 = row0.getCell(0).getCellStyle();
		XSSFCellStyle cellStyle1 = row0.getCell(1).getCellStyle();
		XSSFCellStyle cellStyle2 = row0.getCell(2).getCellStyle();
		XSSFCellStyle cellStyle3 = row0.getCell(3).getCellStyle();
		XSSFCellStyle cellStyle4 = row0.getCell(4).getCellStyle();
		XSSFCellStyle cellStyle5 = row0.getCell(5).getCellStyle();
		XSSFCellStyle cellStyle6 = row0.getCell(6).getCellStyle();
		
		
		row1.getCell(0).setCellStyle(cellStyle6);
		row1.getCell(1).setCellStyle(cellStyle5);
		row1.getCell(2).setCellStyle(cellStyle4);
		row1.getCell(3).setCellStyle(cellStyle3);
		row1.getCell(4).setCellStyle(cellStyle2);
		row1.getCell(5).setCellStyle(cellStyle1);
		row1.getCell(6).setCellStyle(cellStyle0);
		
		/** ===================================================== */
		
		FileOutputStream fo = new FileOutputStream(file);
		xwb.write(fo);
		fo.close();
		
	}
}
